<template>
	<view class="statistics-container">
		<!-- 头部标题 -->
		<view class="header">
			<text class="title">{{datainfo.member_info && datainfo.member_info.nickname}}</text>
		</view>

		<!-- 今日数据概览 -->
		<view class="data-overview">
			<view class="overview-header">
				<text class="header-title">近7日数据</text>
			</view>
			<view class="overview-grid">
				<view class="grid-item">
					<view class="item-label">浏览</view>
					<view class="item-value">{{datainfo.pageviews || 0}}</view>
					<view class="item-trend up">{{datainfo.pageviews_ratio || 0}}%</view>
				</view>
				<view class="grid-item">
					<view class="item-label">互动数</view>
					<view class="item-value">{{datainfo.interaction || 0}}</view>
					<view class="item-trend up">{{datainfo.interaction_ratio|| 0}}%</view>
				</view>
				<view class="grid-item">
					<view class="item-label">新增粉丝</view>
					<view class="item-value">{{datainfo.fans || 0}}</view>
					<view class="item-trend up">{{datainfo.fans_ratio || 0}}%</view>
				</view>
				<view class="grid-item">
					<view class="item-label">主页访客</view>
					<view class="item-value">{{datainfo.home_view || 0}}</view>
					<view class="item-trend up">{{datainfo.home_view_ratio || 0}}%</view>
				</view>
			</view>
			<!-- 示例笔记 -->
			<view class="note-preview" @click="toDetail" >
				<image class="note-image" :src="datainfo.member_note && datainfo.member_note.pic">
				</image>

				<view class="note-info">
					<view class="note-info-flex">
						<text class="note-t" :style="{ background: t('color2') }">最新笔记</text>
						<text class="note-title">{{datainfo.member_note && datainfo.member_note.title}}！</text>
					</view>
					<view class="note-stats">
						<text>浏览 {{datainfo.pageviews || 0}}</text>
						<text>点赞 {{datainfo.thumbs || 0}}</text>
						<text>评论 {{datainfo.comments || 0}}</text>
					</view>
				</view>
				<view class="note-info-text"> 更多> </view>
			</view>
		</view>
		<view class="trend-section">
			<view class="trend-header">
				<text class="section-title">商品带货分析</text>
				<view class="date-range">
					<text>日期范围</text>
					<text class="note-t" :style="{ background: t('color2') }" @click="getdata">近七日</text>
					<text class="note-t" @click="showPicker = true" :style="{ background: t('color2') }">近一个月</text>
				</view>
			</view>
			<!-- 手动引入的组件 -->
			<uni-datetime-picker v-if="showPicker" v-model="range" type="daterange" @maskClick="maskClick" />
			<view class="data-table-container">
				<view class="data-table">
					<!-- 表头 -->
					<view class="table-row header-row" :style="{background:t('color1')}">
						<text class="table-cell rank-cell">排名</text>
						<text class="table-cell product-cell">商品</text>
						<text class="table-cell amount-cell">销售额（元）</text>
						<text class="table-cell volume-cell">销量</text>
						<text class="table-cell rate-cell">转化率</text>
					</view>

					<!-- 表格内容 -->
					<view class="table-body">
						<block v-if="productData &&  productData.length>0">
							<view class="table-row" v-for="(item, index) in product_Data" :key="index">
								<text class="table-cell rank-cell">{{ (currentPage_product - 1) * pageSize_product + index + 1 }}</text></text>
								<view class="table-cell product-cell">
									<text class="product-name">{{ item.name }}</text>
								</view>
								<text class="table-cell amount-cell">{{ item.totalprice }}</text>
								<text class="table-cell volume-cell">{{ item.num }}</text>
								<text class="table-cell rate-cell">{{ item.all_commission }}%</text>
							</view>
						</block>
						<block v-else>
							<view class="nodata-box" >
								暂无数据
							</view>
						</block>
					</view>
				</view>
				<!-- 分页控件 -->
				<view class="pagination" v-if="productData &&  productData.length>0">
					<button class="page-btn" :disabled="currentPage_product === 1" @click="product_prevPage">上一页</button>
					<text class="page-info">第 {{ currentPage_product }} 页 / 共 {{ productPages }} 页</text>
					<button class="page-btn" :disabled="currentPage_product === productPages" @click="product_nextPage">下一页</button>
				</view>
			</view>
		</view>
		<!-- 	<view class="trend-section">
			<view class="trend-header">
				<view class="section-title">
					<text class="section-title-left">用户来源分析</text>
					<text class="section-title-right">统计周期04-21至04-26
					</text>
				</view>
				<view class="date-range">
					<text>日期范围</text>
					<text class="note-t" :style="{ background: t('color2') }">近七日</text>
				</view>
			</view>
			 <view class="pie-legend">
				<view class="legend-item">
					<view class="legend-color" style="background: #4ecb73"></view>
					<text>搜索 84%</text>
				</view>
				<view class="legend-item">
					<view class="legend-color" style="background: #2b85e4"></view>
					<text>首页推荐 10%</text>
				</view>
				<view class="legend-item">
					<view class="legend-color" style="background: #ff9900"></view>
					<text>关注页面 4%</text>
				</view>
				<view class="legend-item">
					<view class="legend-color" style="background: #ed3f14"></view>
					<text>个人主页 2%</text>
				</view>
				<view class="legend-item">
					<view class="legend-color" style="background: #ed3f14"></view>
					<text>其他来源 2%</text>
				</view>
			</view> 
		</view> -->
		<!-- 账号数据趋势 -->
		<view class="trend-section">
			<view class="trend-header">
				<text class="section-title">用户画像分析</text>
				<view class="date-range">
					<text>日期范围</text>
					<text class="note-t" :style="{ background: t('color2') }" @click="getdata">近七日</text>
					<text class="note-t" @click="showPicker2 = true" :style="{ background: t('color2') }">近一个月</text>
				</view>
			</view>
			<uni-datetime-picker v-if="showPicker2" v-model="range2" type="daterange" @maskClick="maskClick" />
			<view class="trend-chart">
				<!-- <view class="chart-header">
					<view class="chart-header-border">
						<view class="chart-label">观看</view>
						<view class="chart-value">367</view>
					</view>
					<view class="chart-header-border">
						<view class="chart-label">观看总时长</view>
						<view class="chart-value">36</view>
					</view>
					<view class="chart-header-border">
						<view class="chart-label">主页访客</view>
						<view class="chart-value">11</view>
					</view>
				</view> -->

				<view class="chart-container">
					<echart ref="pieChart" :option="option" canvasId="pieChart"></echart>
				</view>
				<view class="year-box">
					年龄分布
				</view>
				<!-- 折线图 -->
				<view class="chart-container">
					<echart ref="lineChart" :option="option2" canvasId="lineChart"></echart>
				</view>
			</view>
			<view class="year-box">
				地域分布
			</view>
			<view class="data-table-container">
				<view class="data-table">
					<!-- 表头 -->
					<view class="table-row header-row" :style="{background:t('color1')}">
						<text class="table-cell city-num-cell">排名</text>
						<text class="table-cell city-cell">省份</text>
						<text class="table-cell city-num-cell">人数</text>
						<text class="table-cell city-num-cell">占比</text>
					</view>

					<!-- 表格内容 -->
					<view class="table-body">
						<block v-if="paginatedData && paginatedData.length>0">
							<view class="table-row" v-for="(item, index) in paginatedData" :key="index">
								<text class="table-cell city-num-cell">
									{{ (currentPage - 1) * pageSize + index + 1 }}</text>
								<view class="table-cell city-cell">
									<text class="product-name">{{ item.province }}</text>
								</view>
								<text class="table-cell city-num-cell">{{ item.num }}</text>
								<text class="table-cell city-num-cell">{{ item.radio }}%</text>
							</view>
						</block>
						<block v-else>
							<view class="nodata-box" >
								暂无数据
							</view>
						</block>
					</view>
				</view>
				<!-- 分页控件 -->
				<view class="pagination" v-if="paginatedData && paginatedData.length>0">
					<button class="page-btn" :disabled="currentPage === 1" @click="prevPage">上一页</button>
					<text class="page-info">第 {{ currentPage }} 页 / 共 {{ totalPages }} 页</text>
					<button class="page-btn" :disabled="currentPage === totalPages" @click="nextPage">下一页</button>
				</view>
			</view>

		</view>


		<!-- 来源分析 -->
		<!-- <view class="source-analysis">
			<view class="analysis-header">
				<text class="section-title">观众来源分析</text>
				<view class="date-selector">
					<text class="active">日期范围</text>
					<text class="note-t" :style="{ background: t('color2') }">近七日</text>
				</view>
			</view>
			<view class="pie-chart">
				
				<view class="pie-container">
					<echart ref="pieChart" :option="option" canvasId="pieChart"></echart>
					<view class="pie-legend">
						<view class="legend-item">
							<view class="legend-color" style="background: #4ecb73"></view>
							<text>搜索 84%</text>
						</view>
						<view class="legend-item">
							<view class="legend-color" style="background: #2b85e4"></view>
							<text>个人主页 10%</text>
						</view>
						<view class="legend-item">
							<view class="legend-color" style="background: #ff9900"></view>
							<text>其他入口 4%</text>
						</view>
						<view class="legend-item">
							<view class="legend-color" style="background: #ed3f14"></view>
							<text>个人主页 2%</text>
						</view>
					</view>
				</view>
			</view>
		</view> -->

		<!-- 优质笔记 -->
		<view class="quality-notes">
			<view class="notes-header">
				<text class="section-title">优质笔记</text>
			</view>
			<view class="notes-list">
				<view class="note-item" v-for="(item,index) in quality_list" :key="index">
					<image class="note-image" :src="item.pic">
					</image>
					<view class="note-content">
						<view class="note-text">{{item.title}}</view>
						<view class="note-tag">
							<view class="flex-a" :style="{ background: t('color2') }" v-if="item.is_max_thumbs == 1">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/de0fb06ed544f7d77bdf74a339c256c3.png"
									mode=""></image>
								点赞最多
							</view>
							<view class="flex-a" :style="{ background: t('color2') }" v-if="item.is_max_pageviews == 1">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/bbf822261509059c34877f9556922219.png"
									mode=""></image>
								观看最多
							</view>
							<view class="flex-a" :style="{ background: t('color2') }" v-if="item.is_max_comments == 1">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/ea1769ca95adb3baf1bade419ce7ec40.png"
									mode=""></image>
								评论最多
							</view>
							<view class="flex-a" :style="{ background: t('color2') }" v-if="item.is_max_pageviews == 1">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/081145f05aa168dd392f9391e82d2434.png"
									mode=""></image>
								收藏最多
							</view>
						</view>
						<view class="note-interactions">
							<view class="flex-a">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/de0fb06ed544f7d77bdf74a339c256c3.png"
									mode=""></image>
								{{item.thumbs}}
							</view>
							<view class="flex-a">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/bbf822261509059c34877f9556922219.png"
									mode=""></image>
								{{item.pageviews}}
							</view>
							<view class="flex-a">
								<image class="note-interactions-icon"
									src="https://hedashepin.oss-cn-guangzhou.aliyuncs.com/upload/3/20250410/ea1769ca95adb3baf1bade419ce7ec40.png"
									mode=""></image>
								{{item.comments}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	import echart from "../components/echarts-uniapp/echarts-uniapp.vue";
	import uniDatetimePicker from "../components/uni-datetime-picker/uni-datetime-picker.vue";
	export default {
		data() {
			return {
				option: {},
				option2: {},
				datainfo: {},
				dateRange: ['17岁以下', '18-24岁', '25-29岁', '30-39岁', '40-49岁', '50岁以上', '未知'],
				showPicker: false,
				showPicker2: false,
				range: [],
				range2: [],
				sex_list: [],
				age_list: [],
				quality_list: [],
				productData: [],
				cityData: [

				],
				currentPage_product: 1,
				pageSize_product: 5,
				currentPage: 1,
				pageSize: 5,
			};
		},
		computed: {
			// 分页后的数据
			product_Data() {
				const start = (this.currentPage_product - 1) * this.pageSize_product;
				const end = start + this.pageSize_product;
				return this.productData.slice(start, end);
			},
			// 总页数
			productPages() {
				return Math.ceil(this.productData.length / this.pageSize_product);
			},
			// 分页后的数据
			paginatedData() {
				const start = (this.currentPage - 1) * this.pageSize;
				const end = start + this.pageSize;
				return this.cityData.slice(start, end);
			},
			// 总页数
			totalPages() {
				return Math.ceil(this.cityData.length / this.pageSize);
			}
		},
		components: {
			echart,
			uniDatetimePicker
		},
		watch: {

			range(newval) {
				const that = this;
				const [start_day, end_day] = that.range;
				that.showPicker= false;
				app.get('MemberNote/noteMemberStatistics', {
					start_day: start_day,
					end_day: end_day
				}, function(res) {
					that.loaded();
					if (res.status == 200) {
				
						that.datainfo = res.data.statistics;
						that.quality_list = res.data.statistics.quality_list;
						that.sex_list = res.data.statistics.sex_list;
						that.age_list = res.data.statistics.age_list;
						that.cityData = res.data.statistics.area_list;
						that.productData = res.data.statistics.commission_list;
						that.initChart();
					} else {
						app.error(res.msg)
					}
				});
			},
			range2(newval) {
				const that = this;
				const [start_day, end_day] = that.range2;
				that.showPicker2= false;
				app.get('MemberNote/noteMemberStatistics', {
					start_day: start_day,
					end_day: end_day
				}, function(res) {
					that.loaded();
					if (res.status == 200) {
				
						that.datainfo = res.data.statistics;
						that.quality_list = res.data.statistics.quality_list;
						that.sex_list = res.data.statistics.sex_list;
						that.age_list = res.data.statistics.age_list;
						that.cityData = res.data.statistics.area_list;
						that.productData = res.data.statistics.commission_list;
						that.initChart();
					} else {
						app.error(res.msg)
					}
				});
			},
		},
		onLoad() {
			this.getdata();
		},
		onPullDownRefresh() {
			this.getdata()
		},
		methods: {
			getdata() {
				const that = this;
				// 获取当前日期
				const today = new Date();

				// 计算7天前的日期（最后一天是昨天，所以7天前是 today - 6 days）
				const firstDay = new Date(today);
				firstDay.setDate(today.getDate() - 7); // 7天前（含今天的话是-6）

				// 昨天（近7天的最后一天）
				const lastDay = new Date(today);
				lastDay.setDate(today.getDate() - 1);

				// 格式化日期（示例：YYYY-MM-DD）
				const formatDate = (date) => {
					const year = date.getFullYear();
					const month = String(date.getMonth() + 1).padStart(2, '0');
					const day = String(date.getDate()).padStart(2, '0');
					return `${year}-${month}-${day}`;
				};
				const start_day = formatDate(firstDay);
				const end_day = formatDate(lastDay);
				app.get('MemberNote/noteMemberStatistics', {
					start_day: start_day,
					end_day: end_day
				}, function(res) {
					that.loaded();
					if (res.status == 200) {

						that.datainfo = res.data.statistics;
						that.quality_list = res.data.statistics.quality_list;
						that.sex_list = res.data.statistics.sex_list;
						that.age_list = res.data.statistics.age_list;
						that.cityData = res.data.statistics.area_list;
						that.productData = res.data.statistics.commission_list;
						that.initChart();
					} else {
						app.error(res.msg)
					}
				});
			},
			initChart() {

				this.option = {
					backgroundColor: "#ffffff",
					series: [{
						label: {
							normal: {
								fontSize: 12,
							},
						},
						type: "pie",
						center: ["50%", "50%"],
						radius: ["0%", "80%"],
						data: this.sex_list,
					}, ],
				};
				this.option2 = {
					grid: {
						top: "10rpx",
						left: "10rpx",
						right: "30rpx",
						bottom: "10rpx",
						containLabel: true,
					},
					tooltip: {
						show: true,
						trigger: "axis",
					},
					xAxis: {
						type: "category",
						boundaryGap: false,
						data: this.dateRange,
						axisLine: {
							lineStyle: {
								color: "#E5E5E5",
							},
						},
						axisTick: {
							show: false,
						},
						axisLabel: {
							interval: 0, // 强制显示所有标签

						},
					},

					yAxis: {
						type: "value",
						offset: 10,
						splitLine: {
							lineStyle: {
								type: "dashed",
								color: "#E5E5E5",
							},
						},
						axisLine: {
							show: false,
						},
						axisTick: {
							show: false,
						},
					},
					series: [{
						name: "浏览数",
						type: "bar",
						itemStyle: {
							color: "#579695",
							borderRadius: [4, 4, 0, 0], // 可选的圆角效果
						},
						barWidth: '50%', // 控制柱子的宽度
						data: this.age_list,
					}],
				};
			},
			maskClick(e) {
				console.log('maskClick事件:', e);
			},

			getLast7Days() {
				const days = [];
				for (let i = 6; i >= 0; i--) {
					const date = new Date();
					date.setDate(date.getDate() - i);

					const month = (date.getMonth() + 1).toString().padStart(2, "0");
					const day = date.getDate().toString().padStart(2, "0");

					days.push(`${month}-${day}`);
				}
				return days
			},
			// 上一页
			product_prevPage() {
				if (this.currentPage_product > 1) {
					this.currentPage_product--;
				}
			},
			// 下一页
			product_nextPage() {
				if (this.currentPage_product < this.productPages) {
					this.currentPage_product++;
				}
			},
			// 上一页
			prevPage() {
				if (this.currentPage > 1) {
					this.currentPage--;
				}
			},
			// 下一页
			nextPage() {
				if (this.currentPage < this.totalPages) {
					this.currentPage++;
				}
			},
			toDetail(){
				
				let id = this.datainfo.member_note.id;
				uni.navigateTo({
					url:'/pagesEchart/find/works-detail?id='  + id  + '&type=0'
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
	.statistics-container {
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 30rpx 20rpx;
	}

	.header {
		padding: 20rpx 0;
		background: #fff;
		border-radius: 12rpx;
		margin-bottom: 20rpx;

		.title {
			font-size: 32rpx;
			font-weight: bold;
			color: #333;
			padding: 0 20rpx;
		}
	}

	.data-overview {
		background: #fff;
		border-radius: 12rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;

		.overview-header {
			margin-bottom: 20rpx;

			.header-title {
				font-size: 28rpx;
				font-weight: bold;
				color: #333;
			}
		}

		.overview-grid {
			display: grid;
			grid-template-columns: repeat(4, 1fr);
			gap: 20rpx;
			margin-bottom: 30rpx;

			.grid-item {
				text-align: left;

				.item-label {
					font-size: 24rpx;
					color: #666;
					margin-bottom: 8rpx;
					text-align: center;
				}

				.item-value {
					font-size: 32rpx;
					font-weight: bold;
					margin: 8rpx 0;
					color: #333;
					text-align: center;
				}

				.item-trend {
					font-size: 22rpx;
					color: #999;
					text-align: center;

					&.up {
						color: #ff6b6b;
					}
				}
			}
		}

		.note-preview {
			display: flex;
			padding: 20rpx;
			background: #f8f8f8;
			border-radius: 8rpx;

			.note-image {
				width: 120rpx;
				height: 120rpx;
				border-radius: 8rpx;
				margin-right: 20rpx;
			}

			.note-info {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.note-t {
					color: #666;
					border-radius: 20rpx;
					padding: 4rpx 12rpx;
					font-size: 22rpx;
					display: inline-block;
					margin-bottom: 8rpx;
				}

				.note-info-flex {
					display: -webkit-box;
					-webkit-line-clamp: 2;

					-webkit-box-orient: vertical;

					overflow: hidden;

					text-overflow: ellipsis;
				}

				.note-title {
					font-size: 26rpx;
					color: #333;
					margin-bottom: 10rpx;

				}

				.note-stats {
					font-size: 24rpx;
					color: #999;

					text {
						margin-right: 20rpx;
					}
				}
			}

			.note-info-text {
				color: rgba(16, 16, 16, 1);
				font-size: 24rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}

	.trend-section {
		background: #fff;
		border-radius: 12rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;

		.trend-header {

			margin-bottom: 20rpx;

			.section-title {
				font-size: 28rpx;
				font-weight: bold;
				color: #333;
				display: flex;
				justify-content: space-between;
			}

			.date-range {
				font-size: 24rpx;
				color: #666;
				margin-top: 20rpx;

				text {
					margin-left: 20rpx;
					padding: 4rpx 12rpx;
					border-radius: 20rpx;

					&.active {
						background: #f0f0f0;
					}
				}
			}
		}

		.trend-chart {
			.chart-header {
				display: flex;
				align-items: center;
				justify-content: space-between;

				margin-bottom: 20rpx;
				font-size: 24rpx;

				.chart-header-border {
					border: 1px solid #eee;
					padding: 10rpx;
					border-radius: 20rpx;
					width: 168rpx;
				}

				.chart-label {
					color: #666;
				}

				.chart-value {
					color: #333;
					font-size: 40rpx;
					font-weight: bold;
				}
			}
		}

		.chart-container {
			height: 300rpx;
			margin: 20rpx 0;
		}
	}

	.source-analysis {
		background: #fff;
		border-radius: 12rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;

		.analysis-header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;

			.section-title {
				font-size: 28rpx;
				font-weight: bold;
				color: #333;
			}

			.date-selector {
				font-size: 24rpx;

				text {
					margin-left: 20rpx;

					&.active {
						color: #666;
					}

					&.note-t {
						color: #666;
						padding: 4rpx 12rpx;
						border-radius: 20rpx;
					}
				}
			}
		}

		.pie-container {
			height: 400rpx;
			position: relative;
		}
	}

	.quality-notes {
		background: #fff;
		border-radius: 12rpx;
		padding: 20rpx;

		.notes-header {
			margin-bottom: 20rpx;

			.section-title {
				font-size: 28rpx;
				font-weight: bold;
				color: #333;
			}
		}

		.notes-list {
			.note-item {
				display: flex;
				padding: 20rpx 0;
				border-bottom: 1rpx solid #f5f5f5;

				&:last-child {
					border-bottom: none;
				}

				.note-image {
					width: 120rpx;
					height: 160rpx;
					border-radius: 8rpx;
					margin-right: 20rpx;
					flex-shrink: 0;
				}

				.note-content {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.note-text {
						font-size: 26rpx;
						color: #333;
						margin-bottom: 15rpx;
						display: -webkit-box;
						-webkit-line-clamp: 2;

						-webkit-box-orient: vertical;

						overflow: hidden;

						text-overflow: ellipsis;


						.flex-a {
							border-radius: 20rpx;
							padding: 6rpx;
							font-size: 24rpx;
						}
					}

					.note-tag {
						display: flex;
						gap: 10rpx;
						flex-wrap: wrap;
						font-size: 26rpx;
						color: #333;
						margin-bottom: 15rpx;

						.flex-a {
							border-radius: 20rpx;
							padding: 6rpx;
							font-size: 24rpx;
						}
					}

					.note-interactions {
						font-size: 24rpx;
						color: #999;
						display: flex;
						justify-content: space-between;

						text {
							margin-right: 30rpx;
						}
					}
				}
			}
		}
	}

	.note-interactions-icon {
		width: 30rpx;
		height: 30rpx;
	}

	.flex-a {
		display: flex;
		align-items: center;
		color: rgba(16, 16, 16, 1);
	}

	/* 表格容器 */
	.data-table-container {
		margin-top: 40rpx;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		/* 平滑滚动 */
	}

	/* 表格整体样式 */
	.data-table {
		width: 100%;

		/* 最小宽度保证列宽固定 */
		border-collapse: collapse;
		border: 1px solid #e0e0e0;
		font-size: 14px;
	}

	/* 表格行 */
	.table-row {
		display: flex;
		border-bottom: 1px solid #e0e0e0;
	}

	.table-row:last-child {
		border-bottom: none;
	}

	/* 表头样式 */
	.header-row {
		background-color: #f7f8fa;
		font-weight: bold;
		// color: #333;
	}

	/* 基础单元格样式 */
	.table-cell {
		padding: 12rpx 8rpx;
		border-right: 1px solid #e0e0e0;
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 60rpx;
		box-sizing: border-box;
		overflow: hidden;
		text-align: center;
	}

	/* 移除最后一列的右边框 */
	.table-cell:last-child {
		border-right: none;
	}

	/* 固定列宽设置 */
	.rank-cell {
		width: 15%;
		flex: 0 0 auto;
	}

	.product-cell {
		width: 30%;
		flex: 0 0 auto;
		flex-direction: column;
	}

	.amount-cell {
		width: 20%;
		flex: 0 0 auto;
	}

	.volume-cell {
		width: 15%;
		flex: 0 0 auto;
	}

	.rate-cell {
		width: 20%;
		flex: 0 0 auto;
	}

	/* 商品单元格特殊样式 */
	.product-img {
		width: 80rpx;
		height: 80rpx;
		border-radius: 8rpx;
		margin-bottom: 10rpx;
	}

	.product-name {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 100%;
	}

	/* 内容溢出隐藏 */
	.table-cell>text {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		width: 100%;
		text-align: center;
	}

	.city-num-cell {
		width: 20%;
		flex: 0 0 auto;
	}

	.city-cell {
		width: 40%;
		flex: 0 0 auto;
	}

	.year-box {
		font-weight: 700;
	}

	.pagination {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 20rpx;
		padding: 20rpx 0;
	}

	.page-btn {
		margin: 0 20rpx;
		padding: 10rpx 30rpx;
		font-size: 28rpx;

		border-radius: 8rpx;
	}

	.page-btn:disabled {
		opacity: 0.5;
	}

	.page-info {
		font-size: 28rpx;
		color: #666;
	}
	.nodata-box{
		text-align: center;
		height: 100rpx;
		line-height: 100rpx;
	}
</style>